package com.itmsoft.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import javax.validation.constraints.NotNull;

import com.itmsoft.util.InterfaceUtils;

import org.hibernate.annotations.Index;

/**
 * Simple Stuff entity that has name to show to user. Used for demo purposes.
 * Note that it impelments HasId interface for usefull manipulations with all
 * the enities in {@link InterfaceUtils}.
 */
@Entity
@Table(uniqueConstraints = { @UniqueConstraint(columnNames = { "NAME" }) })
public class Stuff implements HasId
{
    private static final long serialVersionUID = -1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Index(name = "STUFF_NAME")
    @NotNull
    private String name;

    @Override
    public Long getId()
    {
        return id;
    }

    @Override
    public void setId(Long id)
    {
        this.id = id;
    }

    public String getName()
    {
        return name;
    }

    public void setName(String name)
    {
        this.name = name;
    }

}
